package com.quintal.androidtouchcloud.mainActivities;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

import com.quintal.androidtouchcloud.R;

public class FailedUpdateActivity extends Activity {
	@Override
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		getActionBar().setDisplayShowHomeEnabled(false);
		getActionBar().setDisplayShowTitleEnabled(false);
		getActionBar().hide();
		setContentView(R.layout.failed_update_layout);
		int mode = getIntent().getIntExtra("ORIGIN", 1);
		TextView warning_text = (TextView)findViewById(R.id.warning_field);
		TextView warning_title = (TextView)findViewById(R.id.warning_title);
		if(mode==1){
			warning_title.setText(getString(R.string.warning_title));
			warning_text.setText(getApplicationContext().getResources().getString(R.string.folder_warning));
		}else if(mode==2){
			warning_title.setText(getString(R.string.missing_file_title));
			warning_text.setText(getApplicationContext().getResources().getString(R.string.broken_link_warning));
		}else if(mode==3){
			warning_title.setText(getString(R.string.private_tag_title));
			warning_text.setText(getApplicationContext().getResources().getString(R.string.private_tag));
		}else if(mode==4){
			warning_title.setText(getString(R.string.open_file_fail));
			warning_text.setText(getApplicationContext().getResources().getString(R.string.no_app_message));
		}
		else if(mode==5){
			warning_title.setText(getString(R.string.fail_download_title));
			warning_text.setText(getApplicationContext().getResources().getString(R.string.fail_download_warning));
		}
		}
	@Override
	public void onBackPressed(){
		Log.i("FailedUpdateActivity","on back pressed going to the end of the road");
		Intent i = new Intent(getApplicationContext(),EndOfTheRoad.class);
		i.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP| Intent.FLAG_ACTIVITY_CLEAR_TOP);
		i.putExtra("action", 2);
		startActivity(i);			//make sure there arent any loose ends
		finish();
	}
	@Override
	public void onStop(){
		super.onStop();
		finish();
	}
}
